package com.example.goodpet.bean;

import android.os.Parcel;
import android.os.Parcelable;

public class User implements Parcelable {
    private long id;
    private String phoneNumber;
    private String password;
    private String nickname;
    private String portrait;

    /**
     * 0为男,1为女
     */
    private int gender;
    private String signature;
    /**
     * 0为普通用户，1为管理员
     */
    private int identity;
    public User(){}

    public User(long id, String phoneNumber, String password, String nickname, String portrait, int gender, String signature, int identity) {
        this.id = id;
        this.phoneNumber = phoneNumber;
        this.password = password;
        this.nickname = nickname;
        this.portrait = portrait;
        this.gender = gender;
        this.signature = signature;
        this.identity = identity;
    }

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", phoneNumber='" + phoneNumber + '\'' +
                ", password='" + password + '\'' +
                ", nickname='" + nickname + '\'' +
                ", portrait='" + portrait + '\'' +
                ", gender=" + gender +
                ", signature='" + signature + '\'' +
                ", identity=" + identity +
                '}';
    }

    protected User(Parcel in) {
        id = in.readLong();
        phoneNumber = in.readString();
        password = in.readString();
        nickname = in.readString();
        portrait = in.readString();
        gender = in.readInt();
        signature = in.readString();
        identity = in.readInt();
    }

    public static final Creator<User> CREATOR = new Creator<User>() {
        @Override
        public User createFromParcel(Parcel in) {
            return new User(in);
        }

        @Override
        public User[] newArray(int size) {
            return new User[size];
        }
    };

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getPhoneNumber() {
        return phoneNumber;
    }

    public void setPhoneNumber(String phoneNumber) {
        this.phoneNumber = phoneNumber;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public String getPortrait() {
        return portrait;
    }

    public void setPortrait(String portrait) {
        this.portrait = portrait;
    }

    public int getGender() {
        return gender;
    }

    public void setGender(int gender) {
        this.gender = gender;
    }

    public String getSignature() {
        return signature;
    }

    public void setSignature(String signature) {
        this.signature = signature;
    }

    public int getIdentity() {
        return identity;
    }

    public void setIdentity(int identity) {
        this.identity = identity;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeLong(id);
        dest.writeString(phoneNumber);
        dest.writeString(password);
        dest.writeString(nickname);
        dest.writeString(portrait);
        dest.writeInt(gender);
        dest.writeString(signature);
        dest.writeInt(identity);
    }
}
